import json

from django.core import serializers
from django.http import HttpResponse


class ResponseModel:
    def __init__(self, status='200', data='', message='success'):
        self.status = status
        self.data = data
        self.message = message

    @staticmethod
    def success(data='', message='success'):
        # return HttpResponse(serializers.serialize("json", ResponseModel(200, data, message)))
        return json.dumps(ResponseModel('200', data, message))

    @staticmethod
    def error(message='error'):
        # return HttpResponse(serializers.serialize("json", ResponseModel(500, None, message)))
        return json.dumps(ResponseModel('500', '', message))
